package com.yy.studyspringboot.filter;

import com.yy.studyspringboot.filter.FilterTest;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConfig {

    @Bean
    public FilterRegistrationBean reqResFilter() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        FilterTest filterTest = new FilterTest();
        filterRegistrationBean.setFilter(filterTest);
        filterRegistrationBean.addUrlPatterns("*.json");//配置过滤规则
        filterRegistrationBean.setOrder(1);//设置过滤器顺序
        return filterRegistrationBean;
    }
}